﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Chowpoo.Sql;

namespace CourseSystem.Core.Entities
{
     [Table(Name = "CourseStudy")]
    public class CourseStudyInfo : IDetach
    {
        public CourseStudyInfo()
        {
            Detach();
        }
        #region Model
        private int _id;
        private int _sectionid = 0;
        private int _contentid = 0;
        private byte _type = 0;

        private EntityRef<CommonContentInfo> _commonContentInfo;

        [System.Data.Linq.Mapping.Association(Storage = "_commonContentInfo", ThisKey = "ContentId", OtherKey = "Id", IsForeignKey = true)]
        [XmlIgnore]
        public CommonContentInfo CommonContentInfo
        {
            get { return _commonContentInfo.Entity; }
            set { _commonContentInfo.Entity = value; }
        }

        private EntityRef<SectionInfo> _sectionInfo;

        [System.Data.Linq.Mapping.Association(Storage = "_sectionInfo", ThisKey = "SectionId", OtherKey = "Id", IsForeignKey = true)]
        [XmlIgnore]
        public SectionInfo SectionInfo
        {
            get { return _sectionInfo.Entity; }
            set { _sectionInfo.Entity = value; }
        }

        /// <summary>
        /// 
        /// </summary>
      [Column(IsDbGenerated = true, IsPrimaryKey = true, IsVersion = true)]
         public int Id
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
         public int SectionId
        {
            set { _sectionid = value; }
            get { return _sectionid; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
         public int ContentId
        {
            set { _contentid = value; }
            get { return _contentid; }
        }
        /// <summary>
        /// 1案例2PPT3讲授式课件4学科进展
        /// </summary>
        [Column]
         public byte Type
        {
            set { _type = value; }
            get { return _type; }
        }
        #endregion Model

        public void Detach()
        {
            this._commonContentInfo = default(EntityRef<CommonContentInfo>);
            this._sectionInfo = default(EntityRef<SectionInfo>);
        }
    }
}
